package com.baizhi.service.impl;


import com.baizhi.dao.ShebeiDao;
import com.baizhi.entity.Shebei;
import com.baizhi.service.ShebeiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
//@Transactional
public class ShebeiServiceImpl implements ShebeiService {

    private ShebeiDao shebeiDao;
    @Autowired

    public ShebeiServiceImpl(ShebeiDao shebeiDao) {
        this.shebeiDao = shebeiDao;
    }




    @Override
    public void lists(Shebei shebei, Model model) {
        //计算分页
        shebei.setCurrIndex((shebei.getPage() - 1) * shebei.getRows());
        shebei.setPageSize(shebei.getRows());
        List<Shebei> shebeiList = shebeiDao.lists(shebei);
        model.addAttribute("shebeiList", shebeiList);
        model.addAttribute("shebei", shebei);
    }

    @Override
    public Shebei findById(Integer androidId) {
       return shebeiDao.findById(androidId);
   }

    @Override
    public void update(Shebei shebei) {
         shebeiDao.update(shebei);
    }

    @Override
    public void delete(Integer androidId) {
        shebeiDao.delete(androidId);
    }

    @Override
    public void save(Shebei shebei) {
        shebeiDao.save(shebei);
    }
}
